//
//  Created by 计海峰 on 16/5/17.
//  jhf
//
//  Created by 计海峰 on 2017/11/23 14:05:37.
//  Copyright © 2017年 计海峰. All rights reserved.
//

/**
 *  需要添加 JavaScriptCore.framework 进行JS交互
 */

#import <JavaScriptCore/JavaScriptCore.h>
#import "JavaScriptAlertOfUIWebView.h"

#import "JHF_BaseVC.h"
//Define
#import "JDefine.h"
#import "JBaseHttp.h"
#import "JUtil.h" 

typedef void(^WebReponse)(bool,id);


@interface Base_WebviewJS : JHF_BaseVC

//url 参数
@property (nonatomic,strong) NSDictionary *body;

//请求
@property (nonatomic,strong) NSMutableURLRequest *request;

//webView
@property (strong, nonatomic) UIWebView *baseWebview;

//是否需要空显示 默认NO
@property (nonatomic,assign) BOOL emptyData;

//是否需要处理JS 默认NO
@property (nonatomic,assign) BOOL dealJS;

//是否需要断网刷新 需要开启AF网络监听 默认NO
@property (nonatomic,assign) BOOL needNetMonit;

//是否post提交
@property (nonatomic,assign) BOOL isPost;

//webview frame 
@property (nonatomic,assign) UIEdgeInsets padding;

/**
 *  加载本地的HTML文件
 *
 *  @param htmlFileName HTML文件的名称
 *
 *  @return 实体
 */
- (instancetype)initWithLocalName:(NSString *)htmlFileName;

/**
 *  网页初始化
 *
 *  @param urlString 基本的请求地址
 *  @param body      参数 
 *
 *  @return 实体
 */
- (instancetype)initWithUrlString:(NSString *)urlString withBody:(NSDictionary *)body ;

//刷新网页
- (void)refreshWebView;

#pragma mark webview delegate 子类重写用的
- (void)webViewDidStartLoad:(UIWebView *)webView;
- (void)webViewDidFinishLoad:(UIWebView *)webView;
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error;
@end
